#include "libmath.hpp"
using namespace sdl_engine;

int main([[ maybe_unused ]] int argc,
         [[ maybe_unused ]] char** argv) {
    Point p1 = {1, 2};
    assert(p1.x == 1 && p1.y == 2);

    Point p2 = p1;
    assert(p2.x == 1 && p2.y == 2);

    Point defaultP;
    assert(defaultP.x == 0 && defaultP.y == 0);

    defaultP = p2;
    assert(defaultP.x == 1 && defaultP.y == 2);

    Point addP = p1 + p2;
    assert((addP.x == p1.x + p2.x) && (addP.y == p1.y + p2.y));

    Point minusP = p1 - p2;
    assert((minusP.x == p1.x - p2.x) && (minusP.y == p1.y - p2.y));

    assert(!PointInRect(point(1, 1), rect(0, 2, 2, 2)));
    assert(PointInRect(point(1, 1), rect(0, 0, 2, 2)));
    assert(!PointInRect(point(1, 1), rect(2, 2, 2, 2)));

    assert(!IsRectsIntersect(rect(0, 2, 1, 1), rect(1, 1, 2, 2)));
    assert(IsRectsIntersect(rect(0, 2, 2, 2), rect(1, 1, 2, 2)));

    assert(!IntersectRects(rect(0, 0, 2, 1), rect(1, 2, 2, 1)).Valid());
    assert(IntersectRects(rect(0, 0, 2, 1), rect(1, 0, 1, 2)) == rect(1, 0, 1, 1));
    assert(IntersectRects(rect(0, 0, 4, 5), rect(1, 1, 2, 2)) == rect(1, 1, 2, 2));
    return 0;
}
